#include <stdlib.h>
#include <iostream>

using namespace std;

int main(int argc,char *argv[])
{
  int binsize=10;
  int columns=2;

  //binsizestuff
  if(argc < 2 )
    cerr << "no binsize specified, using default" << endl;
  else
    binsize = atoi(argv[1]);
  if(binsize<=0) { 
    cerr << "binsize<=0 is not allowed" << endl; exit(1);
  }  
  cerr << "binsize=" << binsize << endl;

  //columns stuff
  if(argc < 3 )
    cerr << "number of columns not specified, using default" << endl;
  else
    columns = atoi(argv[2]);
  if(columns<=0) { 
    cerr << "number of columns <= 0 is not allowed" << endl; exit(1);
  }  
  cerr << "columns=" << columns << endl;

  int *column = new int[columns];
  if(!column) {
    cerr << "error: could not allocate mem for columns" << endl; exit(1);
  }

  int *binned = new int[columns];
  if(!binned) {
    cerr << "error: could not allocate mem for binned" << endl; exit(1);
  }

  int lineno=1;
  while(! cin.eof() ) {

    for(int k=0; k<columns; k++) binned[k]=0;      //clear bin

    for(int j=0; j<binsize; j++) {
            cerr << lineno++ << ": " ;

      for(int i=0; i<columns; i++) {
	cin >> column[i]; binned[i] += column[i];
	cerr << column[i] << " ";
      }
      cerr << endl << "#";
      
      for(int i=0; i<columns; i++) 
	cerr << binned[i] << " ";

      cerr << endl;
    }

    for(int i=0; i<columns; i++) cout << binned[i] << " ";
    cout << endl;
  }
}
